/*Author Rajith Chathunga,
 *		 Computer Science and Engineering,
 *		 University of Moratuwa.
 *
 * Class name : Option
 * 
 *  			
 * This class handle user inputs and send them to QNews class. This class extends Activity and
 *  implements onClickListener.*/

package chathunga.qNews;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;


public class Option extends Activity implements OnClickListener {
	Button ok;
	EditText url;
	static String url1;
	ImageView img;
	Bundle b = new Bundle();
	
	public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.option); 
        ok=(Button)findViewById(R.id.ok);
        img=(ImageView)findViewById(R.id.qn);
        img.setOnClickListener(this);
        url=(EditText)findViewById(R.id.url);
        ok.setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		if(v.getId()==R.id.ok){
			
			url1=url.getText().toString();
			
			b.putString("key", url1);
			
			Intent it= new Intent(this,QNews.class);
			
			it.putExtras(b);
			
			startActivity(it);

		}
		if(v.getId()==R.id.qn){
			
			this.finish();
			
			Intent bToHome= new Intent(this,MainQNews.class);
			
			startActivity(bToHome);
			
			finish();
		}
	}

}
